<?php

include 'check.php';

mysql_query ("INSERT INTO `user`(`usuario`, `senha`, `nivel`) VALUES (
    '" . $_POST["user"] . "',
    '" . $_POST["pass"] . "',
    '" . $_POST["level"] . "'
    )") or die(mysql_error());

if ($_POST["level"] == "Medico") 
    mysql_query ("INSERT INTO `medicos`(`Nome`, `Sobrenome`, `RG`, `CPF`, `Telefone1`, `Telefone2`, `Email`, `Plano_de_Saude`, `CRM`, `Especialidade`) VALUES (
        '" . $_POST["name"] . "',
        '" . $_POST["lastName"] . "',
        '" . $_POST["rg"] . "',
        '" . $_POST["cpf"] . "',
        '" . $_POST["tel1"] . "',
        '" . $_POST["tel2"] . "',
        '" . $_POST["email"] . "',
        '" . $_POST["insurance"] . "',
        '" . $_POST["crm"] . "',
        '" . $_POST["special"] . "'                            
    )") or die(mysql_error());
else 
    mysql_query("INSERT INTO `funcionarios`(`Nome`, `Sobrenome`, `RG`, `CPF`, `Telefone1`, `Telefone2`, `Email`) VALUES (
        '" . $_POST["name"] . "',
        '" . $_POST["lastName"] . "',
        '" . $_POST["rg"] . "',
        '" . $_POST["cpf"] . "',
        '" . $_POST["tel1"] . "',
        '" . $_POST["tel2"] . "',
        '" . $_POST["email"] . "'
    )") or die(mysql_error());

?>

<html>
    <head>
        <title>Main</title>
        <link rel="stylesheet" href="css/index.css">
    </head>

    <body>
    <center><div><button class="pure-button pure-button-disabled">Funcionario Cadastrado com Sucesso!</button></div>

        <br>

        <div><a class="pure-button pure-button-primary" href="mainAdmin.php">Voltar para a Tela Inicial</a></div></center>
</body>
</html>